package com.cw.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.*;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.service.impl.*;
import com.cw.entity.*;
import com.cw.mapper.*;
import com.cw.service.*;
import java.util.*;
import org.springframework.stereotype.*;

/**
 * <p>
 * 病区 服务实现类
 * </p>
 *
 * @author smq
 * @since 2021-04-27
 */
@Service
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IAreaService {

    /**
     * 根据病区编号获取病区
     *
     * @param areaCode
     * @return
     */
    @Override
    public Area getArea(String areaCode) {
	  Area area = new Area();
	  List<Area> areaList = baseMapper.selectList(new LambdaQueryWrapper<>(new Area()).eq(Area::getAreaCode, areaCode).eq(Area::getDeleteFlag, "0"));
	  if (CollectionUtils.isNotEmpty(areaList)) {
		area = areaList.get(0);
	  }
	  return area;
    }
}
